from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String, UniqueConstraint
from config.database import Base


class ComparativeProfessionalThesaurus(Base):
    """
    专业词库表
    """

    __tablename__ = 'comparative_professional_thesaurus'

    thesaurus_id = Column(Integer, primary_key=True, autoincrement=True, comment='词库主键')
    thesaurus_name = Column(String(100), nullable=True, default='', comment='词库名称')
    thesaurus_type = Column(String(100), nullable=True, default='', comment='词库类型')
    status = Column(String(1), nullable=True, default='0', comment='状态（0正常 1停用）')
    create_by = Column(String(64), nullable=True, default='', comment='创建者')
    create_time = Column(DateTime, nullable=True, default=datetime.now(), comment='创建时间')
    update_by = Column(String(64), nullable=True, default='', comment='更新者')
    update_time = Column(DateTime, nullable=True, default=datetime.now(), comment='更新时间')
    remark = Column(String(500), nullable=True, default='', comment='备注')

    __table_args__ = (UniqueConstraint('thesaurus_type', name='uq_sys_dict_type_dict_type'),)


class ComparativeProfessionalData(Base):
    """
    专业词库数据表
    """

    __tablename__ = 'comparative_professional_data'

    data_id = Column(Integer, primary_key=True, autoincrement=True, comment='数据主键')
    thesaurus_type = Column(String(100), nullable=True, default='', comment='词库类型')
    data_name = Column(String(100), nullable=True, default='', comment='数据名称')
    status: str = Column(String(1), nullable=True, default='0', comment='状态（0正常 1停用）')
    data_sort = Column(Integer, nullable=True, default=0, comment='字典排序')
    create_by = Column(String(64), nullable=True, default='', comment='创建者')
    create_time = Column(DateTime, nullable=True, default=datetime.now(), comment='创建时间')
    update_by = Column(String(64), nullable=True, default='', comment='更新者')
    update_time = Column(DateTime, nullable=True, default=datetime.now(), comment='更新时间')
    remark = Column(String(500), nullable=True, default='', comment='备注')
